from etgui import *
from PageLayout import *

class NoteForExternalBrowserSwitcher:
	def __init__(self,model,slot,note):
		model.AddModelObserver(self,slot)
		self.note=note
		self.slot=slot
	def __call__(self,model,slot):
		v=Cast(model).GetValue(self.slot)
		if v in ("htmlviewer","hh"):
			self.note.SetString("")
		else:
			self.note.SetString("Make Sure Your PATH Points to the Selected Browser!")

def MakePageOthers(model):
	path="GUI.General"+'.'

	deleteKey=PotGuiPopupButton(path+"UseDeleteKey")
	deleteKey.AddItem("BackSpace",0)
	deleteKey.AddItem("Delete",1)

#	docuViewer=PotGuiPopupButton("Sniff.HelpTool")
#	docuViewer.AddItem("SNiFF+ Browser","htmlviewer")
#	docuViewer.AddItem("Netscape","netscape")
#	if IsWindows():
#		docuViewer.AddItem("Internet Explorer","iexplore")
#		docuViewer.AddItem("Windows Help","hh")
#
#	note_text=MultilineTextItem("")
#	NoteForExternalBrowserSwitcher(model,"Sniff.HelpTool",note_text)
#
	return MakePageLayout(eVObjHExpand|eVObjVCenter,
#		MakeBorderedSectionLayout("Online Documentation",
#			Form(
#				items=[
#					"Viewer",MakeFieldLayout(docuViewer)
#				]
#			),
#			note_text
#		),
		MakeBorderedSectionLayout("General Settings",
			Form(
				items=[
					"Function of Delete Key",MakeFieldLayout(deleteKey),
					"Double Click Time [ms]",PotGuiIntField(path+"DoubleClickTime",IntField(-1,500,0,1024)),
					"Scroll Time [ms]",PotGuiIntField(path+"ScrollTime",IntField(-1,20,1,500)),
					"Scroll Width [Pixel]",PotGuiIntField(path+"ScrollStep",IntField(-1,32,1,500))
				]
			),
			PotGuiToggleButton(path+"StoreWindowLayout","Store Window Layout between Sessions"),
			PotGuiToggleButton(path+"ReallyReallyQuit","Ask for Confirmation before Quitting SNiFF+"),
			PotGuiToggleButton(path+"UnixFileMatching","Use Case Sensitive File Matching"),
			PotGuiToggleButton("GlobalFileTypes","Global File Type Menus")#,
#			PotGuiToggleButton("Sniff.DebugObserve","Debug Observe"),
#			PotGuiToggleButton(path+"PMT","Pseudo Multithreading"),
#			PotGuiToggleButton(path+"AnimatedIcons","Animations"),
#			PotGuiToggleButton(path+"AnimatedIconsExactTiming","Exact Timing for Animations")
		)
	)
